/*
 * GenericFunctor.h
 *
 *  Created on: 19.05.2011
 *      Author: aaw707
 */

#ifndef GENERICFUNCTOR_H_
#define GENERICFUNCTOR_H_

#include <stdio.h>
#include <sys/neutrino.h>
#include <hw/inout.h>
#include <cstdlib>
#include <iostream>
#include <unistd.h>
#include <errno.h>

#include "CallInterface.h"
#include "CallBackTest.h"


template<class T>
class GenericFunctor : public CallInterface {
public:
	typedef void (T::*fpType)();
	GenericFunctor(T& object, fpType fp)
	: object_(object)
	, fp_(fp)
	{}
	// Inherited from CallInterface
	virtual void callback() {
		(object_.*fp_)();
	}
private:
	T& object_;
	fpType fp_;
};

#endif /* GENERICFUNCTOR_H_ */
